package com.datas
{
	public class Data extends DataBase
	{
		private var dataObject:Object = new Object();
		private static var data:Data;
		
		public function Data()
		{
			if(data){
				throw Error('Data不能重复实例化!')
			}else{
				data = this;
			}
			trace('--->创建Data实例!')
		}
		
		public static function getInstance():Data{
			if(!data) data = new Data();
			return data;
		}
		
		private function createObject(className:Class):*
		{
			var key:String = String(className).split('[class ')[1].split(']')[0];
			
			if(dataObject[key]) return dataObject[key];
			
			dataObject[key] = new className();
			
			return dataObject[key];
		}
		
		public function get example():ExampleData{
			return createObject(ExampleData) as ExampleData;
		}
		
	}
}